#include "elements.h"

#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK

#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_tools.hpp>

Elements e;

void checkOneElement(size_t idx, size_t elem)
{
    BOOST_CHECK_EQUAL(e[idx], elem);
    BOOST_CHECK_EQUAL(e.findVertexIndex(elem), idx);
}

BOOST_AUTO_TEST_CASE(elements_test) {
    checkOneElement(0, 0);
    checkOneElement(1, 1);
    checkOneElement(2, SIZE_VMSK);
    checkOneElement(NUM_VERTICES - 1, (SIZE_VMSK - 1) << n);
    checkOneElement(1 + 2 * 3 + 1 * 27, 1 + (1 << (n + 1)) + 8);
    checkOneElement(2 + 2 * 3 + 2 * 9, (1 + 2 + 4) << n);
}
